// 记分牌 
export default class ScorePanel {
    score: number;
    level: number;
    scoreEle: HTMLElement;
    levelEle: HTMLElement;
    MaxLevel: number;
    upScoe: number

    constructor(maxLevel: number = 10,upScoe: number = 10){
        this.score = 0;
        this.level = 1;
        this.scoreEle = document.getElementById('score')!;
        this.levelEle = document.getElementById('level')!;
        this.MaxLevel = maxLevel;
        this.upScoe = upScoe
    }
    
    addScore(){
        this.scoreEle.innerHTML = ++this.score + ""
        if(this.score % this.upScoe === 0){
            this.levelUp()
        }
    }
    // 提升等级 | 提升速度
    levelUp(){
        if(this.level < this.MaxLevel){
            this.levelEle.innerHTML = ++this.level + ""
        }
    }
}

// 测试
// let ScorePanelOne = new ScorePanel();
// ScorePanelOne.addScore()
// ScorePanelOne.addScore()
// ScorePanelOne.levelUp()
// ScorePanelOne.levelUp()
// for(let i = 0 ; i < 63; i++ ){
//     ScorePanelOne.addScore()
// }